<template>
  <div class="demo-basic-vueStudyChild-attrDemo">
    <section>
      <h3>get (urlKey, config, ..., argN)</h3>
      <p><b>urlKey</b>: 对应API 中的urlkey</p>
      <p><b>config</b>: 发送ajax传递的参数对象，如果对象中没params值，则认为它就是 { params: params },如果有，则认为它是 config </p>
      <p><b>argN</b>: 可配置无数个参数，第三个至最后的一个参数会以'/'为连接符拼至请求 url 中</p>
    </section>
    <pre>
      <code class="javascript">
      import getData from '...'
      var params = { ... };

      // http://baolv.cs2025.com/v1/sys/securityPolicy
      getData.<b>get</b>('key',  params)

      getData.<b>get</b>('key', {
        params: params,
        ...
      })

      // http://baolv.cs2025.com/v1/system/organizations/orgId/staffs/tag
      getData.<b>get</b>('key', params, 'orgId', 'staffs', 'tag'...)

      getData.<b>get</b>('key', {
        params: params,
        ...
      }, 'orgId', 'staffs', 'tag'...)
      </code>
    </pre>

    <section>
      <h3>getUrl (url, config)</h3>
      <p><b>url</b>: 对应API 中的urlkey</p>
      <p><b>config</b>: 发送ajax传递的参数对象，如果对象中没params值，则认为它就是 { params: params },如果有，则认为它是 config </p>
    </section>
    <pre>
      <code class="javascript">
      import getData from '...'
      var params = { ... };

      // http://baolv.cs2025.com/v1/sys/securityPolicy
      getData.<b>getUrl</b>('http://baolv.cs2025.com/v1/sys/securityPolicy', params)

      getData.<b>getUrl</b>('http://baolv.cs2025.com/v1/sys/securityPolicy', {
        params: params,
        ...
      })
      </code>
    </pre>

    <section>
      <h3>getRestful (urlKey, params, config)</h3>
      <p><b>url</b>: 对应API 中的urlkey</p>
      <p><b>params</b>: Restful键值对</p>
      <p><b>config</b>: 发送ajax传递的参数对象</p>
    </section>
    <pre>
      <code class="javascript">
      import getData from '...'

      // http://baolv.cs2025.com/v1/system/organizations/{orgId}
      getData.<b>getRestful</b>('key', { orgId: '123' }, config)
      </code>
    </pre>
  </div>
</template>

<script>
  import hljs from 'highlight.js'
  export default {
    // 组件被挂载的时候执行的方法
    mounted: function () {
      window.setTimeout(function () {
        $('.demo-basic-vueStudyChild-attrDemo pre code').each(function(i, block) {

          hljs.highlightBlock(block);
        });
      }, 200);
    }
  }
</script>
